<?php

class limpiarPenalizacionesTask extends sfBaseTask
{

  protected function configure()
  {
    // // add your own arguments here
    // $this->addArguments(array(
    //   new sfCommandArgument('my_arg', sfCommandArgument::REQUIRED, 'My argument'),
    // ));

    $this->addOptions(array(
      new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name'),
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
      new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'),
      // add your own options here
    ));

    $this->namespace = '';
    $this->name = 'limpiarPenalizaciones';
    $this->briefDescription = '';
    $this->detailedDescription = <<<EOF
The [limpiarPenalizaciones|INFO] task does things.
Call it with:

  [php symfony limpiarPenalizaciones|INFO]
EOF;

  }

  protected function execute($arguments = array(), $options = array())
  {
    // initialize the database connection
    $databaseManager = new sfDatabaseManager($this->configuration);
    $connection = $databaseManager->getDatabase($options['connection'])->getConnection();

    // add your code here
    $personas = BbPersonaPeer::getPersonasConPenalizacionesVencidas();
    if ($personas)
    {
      foreach ($pesonas as $persona)
      {
        $persona->setEstado(ReferenceEstadoPersona::NORMAL);
      }
    }

  }

}
